Platform Explorer / Nuxeo Platform 5.8

Component org.nuxeo.ecm.multi.tenant.directories

Contributions

XML Source

<?xml version="1.0"?>
<component name="org.nuxeo.ecm.multi.tenant.directories">

  <require>org.nuxeo.ecm.directories</require>
  <require>org.nuxeo.ecm.webapp.directory.directoryUI</require>

  <extension target="org.nuxeo.ecm.core.schema.TypeService" point="schema">
    <schema name="tenant" src="schemas/tenant.xsd" />
  </extension>

  <extension target="org.nuxeo.ecm.directory.sql.SQLDirectoryFactory"
    point="directories">

    <directory name="tenants">
      <schema>tenant</schema>
      <dataSource>java:/nxsqldirectory</dataSource>
      <cacheTimeout>3600</cacheTimeout>
      <cacheMaxSize>1000</cacheMaxSize>
      <table>tenants</table>
      <idField>id</idField>
      <createTablePolicy>on_missing_columns</createTablePolicy>
    </directory>

    <directory name="topic">
      <schema>multitenantvocabulary</schema>
      <dataSource>java:/nxsqldirectory</dataSource>
      <cacheTimeout>3600</cacheTimeout>
      <cacheMaxSize>1000</cacheMaxSize>
      <table>topic</table>
      <idField>id</idField>
      <autoincrementIdField>false</autoincrementIdField>
      <dataFile>directories/topic.csv</dataFile>
      <createTablePolicy>on_missing_columns</createTablePolicy>
    </directory>

    <directory name="subtopic">
      <schema>multitenantxvocabulary</schema>
      <parentDirectory>topic</parentDirectory>
      <dataSource>java:/nxsqldirectory</dataSource>
      <cacheTimeout>3600</cacheTimeout>
      <cacheMaxSize>1000</cacheMaxSize>
      <table>subtopic</table>
      <idField>id</idField>
      <autoincrementIdField>false</autoincrementIdField>
      <dataFile>directories/subtopic.csv</dataFile>
      <createTablePolicy>on_missing_columns</createTablePolicy>
    </directory>

  </extension>

  <extension target="org.nuxeo.ecm.directory.ui.DirectoryUIManager"
    point="directories">

    <directory name="topic" layout="multi_tenant_vocabulary" sortField="label">
      <deleteConstraint
        class="org.nuxeo.ecm.directory.api.ui.HierarchicalDirectoryUIDeleteConstraint">
        <property name="targetDirectory">subtopic</property>
        <property name="targetDirectoryField">parent</property>
      </deleteConstraint>
    </directory>
    <directory name="subtopic" layout="multi_tenant_subtopic_vocabulary" sortField="parent" />
  </extension>

  <extension target="org.nuxeo.ecm.platform.forms.layout.WebLayoutManager"
    point="widgets">

    <widget name="multi_tenant_vocabulary_id" type="text">
      <labels>
        <label mode="any">label.vocabulary.entry.id</label>
      </labels>
      <translated>true</translated>
      <fields>
        <field>multitenantvocabulary:id</field>
      </fields>
      <widgetModes>
        <mode value="edit">view</mode>
      </widgetModes>
      <properties widgetMode="edit">
        <property name="required">true</property>
      </properties>
    </widget>

    <widget name="multi_tenant_vocabulary_label" type="text">
      <labels>
        <label mode="any">label.vocabulary.entry.label</label>
      </labels>
      <translated>true</translated>
      <fields>
        <field>multitenantvocabulary:label</field>
      </fields>
      <properties widgetMode="edit">
        <property name="size">50</property>
      </properties>
    </widget>

    <widget name="multi_tenant_vocabulary_obsolete" type="template">
      <labels>
        <label mode="any">label.vocabulary.entry.obsolete</label>
      </labels>
      <translated>true</translated>
      <fields>
        <field>multitenantvocabulary:obsolete</field>
      </fields>
      <properties mode="any">
        <property name="template">
          /widgets/integer_yes_no_widget_template.xhtml
        </property>
      </properties>
    </widget>

    <widget name="multi_tenant_vocabulary_order" type="int">
      <labels>
        <label mode="any">label.vocabulary.entry.order</label>
      </labels>
      <translated>true</translated>
      <fields>
        <field>multitenantvocabulary:ordering</field>
      </fields>
      <properties widgetMode="edit">
        <property name="size">10</property>
      </properties>
    </widget>

    <widget name="multi_tenant_xvocabulary_id" type="text">
      <labels>
        <label mode="any">label.vocabulary.entry.id</label>
      </labels>
      <translated>true</translated>
      <fields>
        <field>multitenantxvocabulary:id</field>
      </fields>
      <widgetModes>
        <mode value="edit">view</mode>
      </widgetModes>
      <properties widgetMode="edit">
        <property name="required">true</property>
      </properties>
    </widget>

    <widget name="multi_tenant_xvocabulary_label" type="text">
      <labels>
        <label mode="any">label.vocabulary.entry.label</label>
      </labels>
      <translated>true</translated>
      <fields>
        <field>multitenantxvocabulary:label</field>
      </fields>
      <properties widgetMode="edit">
        <property name="size">50</property>
      </properties>
    </widget>

    <widget name="multi_tenant_xvocabulary_obsolete" type="template">
      <labels>
        <label mode="any">label.vocabulary.entry.obsolete</label>
      </labels>
      <translated>true</translated>
      <fields>
        <field>multitenantxvocabulary:obsolete</field>
      </fields>
      <properties mode="any">
        <property name="template">
          /widgets/integer_yes_no_widget_template.xhtml
        </property>
      </properties>
    </widget>

    <widget name="multi_tenant_xvocabulary_order" type="int">
      <labels>
        <label mode="any">label.vocabulary.entry.order</label>
      </labels>
      <translated>true</translated>
      <fields>
        <field>multitenantxvocabulary:ordering</field>
      </fields>
      <properties widgetMode="edit">
        <property name="size">10</property>
      </properties>
    </widget>
  </extension>

  <extension target="org.nuxeo.ecm.platform.forms.layout.WebLayoutManager"
    point="layouts">

    <layout name="multi_tenant_vocabulary">
      <templates>
        <template mode="any">
          /directory/directory_layout_template.xhtml
        </template>
      </templates>
      <rows>
        <row>
          <widget>multi_tenant_vocabulary_id</widget>
        </row>
        <row>
          <widget>multi_tenant_vocabulary_label</widget>
        </row>
        <row>
          <widget>multi_tenant_vocabulary_obsolete</widget>
        </row>
        <row>
          <widget>multi_tenant_vocabulary_order</widget>
        </row>
      </rows>
    </layout>

    <layout name="multi_tenant_subtopic_vocabulary">
      <templates>
        <template mode="any">
          /directory/directory_layout_template.xhtml
        </template>
      </templates>
      <rows>
        <row>
          <widget>parent</widget>
        </row>
        <row>
          <widget>multi_tenant_xvocabulary_id</widget>
        </row>
        <row>
          <widget>multi_tenant_xvocabulary_label</widget>
        </row>
        <row>
          <widget>multi_tenant_xvocabulary_obsolete</widget>
        </row>
        <row>
          <widget>multi_tenant_xvocabulary_order</widget>
        </row>
      </rows>
      <widget name="parent" type="selectOneDirectory">
        <labels>
          <label mode="any">label.vocabulary.entry.parent</label>
        </labels>
        <translated>true</translated>
        <fields>
          <field>multitenantxvocabulary:parent</field>
        </fields>
        <properties mode="any">
          <property name="directoryName">topic</property>
          <property name="localize">true</property>
        </properties>
        <properties widgetMode="edit">
          <property name="required">true</property>
        </properties>
      </widget>
    </layout>
  </extension>

</component>